package com.yinhe.system.service.impl;

import java.util.List;

import com.yinhe.common.annotation.DataScope;
import com.yinhe.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yinhe.system.mapper.YhDutyrecordMapper;
import com.yinhe.system.domain.YhDutyrecord;
import com.yinhe.system.service.IYhDutyrecordService;

/**
 * 值班记录Service业务层处理
 * 
 * @author yinhe
 * @date 2022-07-13
 */
@Service
public class YhDutyrecordServiceImpl implements IYhDutyrecordService 
{
    @Autowired
    private YhDutyrecordMapper yhDutyrecordMapper;

    /**
     * 查询值班记录
     * 
     * @param id 值班记录主键
     * @return 值班记录
     */
    @Override
    public YhDutyrecord selectYhDutyrecordById(Long id)
    {
        return yhDutyrecordMapper.selectYhDutyrecordById(id);
    }

    /**
     * 查询值班记录列表
     * 
     * @param yhDutyrecord 值班记录
     * @return 值班记录
     */
    @Override
    @DataScope(deptAlias = "yh_dutyrecord", userAlias = "yh_dutyrecord")
    public List<YhDutyrecord> selectYhDutyrecordList(YhDutyrecord yhDutyrecord)
    {
        return yhDutyrecordMapper.selectYhDutyrecordList(yhDutyrecord);
    }

    /**
     * 新增值班记录
     * 
     * @param yhDutyrecord 值班记录
     * @return 结果
     */
    @Override
    public int insertYhDutyrecord(YhDutyrecord yhDutyrecord)
    {
        yhDutyrecord.setCreateTime(DateUtils.getNowDate());
        return yhDutyrecordMapper.insertYhDutyrecord(yhDutyrecord);
    }

    /**
     * 修改值班记录
     * 
     * @param yhDutyrecord 值班记录
     * @return 结果
     */
    @Override
    public int updateYhDutyrecord(YhDutyrecord yhDutyrecord)
    {
        yhDutyrecord.setUpdateTime(DateUtils.getNowDate());
        return yhDutyrecordMapper.updateYhDutyrecord(yhDutyrecord);
    }

    /**
     * 批量删除值班记录
     * 
     * @param ids 需要删除的值班记录主键
     * @return 结果
     */
    @Override
    public int deleteYhDutyrecordByIds(Long[] ids)
    {
        return yhDutyrecordMapper.deleteYhDutyrecordByIds(ids);
    }

    /**
     * 删除值班记录信息
     * 
     * @param id 值班记录主键
     * @return 结果
     */
    @Override
    public int deleteYhDutyrecordById(Long id)
    {
        return yhDutyrecordMapper.deleteYhDutyrecordById(id);
    }
}
